import request from '@/utils/request'

export function uploadImgOld(data) {
  return request({
    url: '/kmpt/biz/update',
    method: 'post',
    // requestBase:'VUE_APP_BUSINESS_API',
    headers: { 'Content-Type': 'multipart/form-data' },
    data
  })
}

export function uploadImg(data) {
  return request({
    url: '/kmpt/biz/upload/new/images',
    method: 'post',
    // requestBase:'VUE_APP_BUSINESS_API',
    headers: { 'Content-Type': 'multipart/form-data' },
    data
  })
}

export function uploadFile(data) {
  return request({
    url: '/kmpt/biz/upload/new/files',
    method: 'post',
    // requestBase:'VUE_APP_BUSINESS_API',
    headers: { 'Content-Type': 'multipart/form-data' },
    data
  })
}

export function uploadDownload(data) {
  return request({
    url: '/kmpt/biz/download/new',
    method: 'post',
    // requestBase:'VUE_APP_BUSINESS_API',
    headers: { 'Content-Type': 'application/json;charset=UTF-8' },
    data
  })
}

export async function uploadDownloadView(fileId) {
  try{
    const res = await uploadDownload({
      fileId: fileId
    });
    return 'data:image/png;base64,' + res.data
  }catch(e){
    console.log("图片返回状态：")
    console.log(e)
    return null
  }



}
